package com.weds.data_sync.pojo.dto;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.List;

/**
 * @Description 脚本DTO
 * @Author lihw
 * @Date 2024/1/5 15:19
 */
@Schema(name = "ScriptDto", description = "脚本实体")
@Data
public class ScriptDto {

    @Schema(description = "主键", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    private Long id;

    @Schema(description = "主键列表", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    private List<Long> ids;

    @NotBlank(message = "脚本名称不能为空")
    @Schema(description = "脚本名称")
    private String scriptName;

    @Schema(description = "脚本描述", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    private String scriptDesc;

    // @NotBlank(message = "脚本模块路径不能为空")
    @Schema(description = "模块所在路径")
    private String modulePath;

    // @NotBlank(message = "模块名不能为空")
    @Schema(description = "模块名")
    private String moduleName;

    @Schema(description = "类名", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    private String className;

    // @NotBlank(message = "函数名不能为空")
    @Schema(description = "函数名")
    private String funcName;

    @Schema(description = "函数参数", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    private String funcParam;

    @NotNull(message = "存储类型不能为空")
    @Schema(description = "源码存储类型： 1 文件 2 文本内容")
    private Integer saveType;

    @Schema(description = "脚本上下文命令: python,node等", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    private String sourceContext;

    @Schema(description = "脚本前置命令", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    private String prefixCmd;

    @Schema(description = "脚本后置命令", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    private String suffixCmd;

    @NotNull(message = "源码类型不能为空")
    @Schema(description = "源码类型: 1 py 2 js")
    private Integer sourceType;

    @Schema(description = "脚本源码", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    private String sourceCode;

    @Schema(description = "脚本文件", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    private byte[] scriptFile;

    @Schema(description = "脚本文件的base64编码", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    private String scriptFileBase64Str;

    @NotNull(message = "执行方式不能为空")
    @Schema(description = "执行方式:1 rest 2 native")
    private Integer runType;

    @Schema(description = "脚本分组id")
    private Long groupId;

    private Integer isDefault;
}
